import React from 'react';
import {withRouter,HashRouter,Route} from 'react-router-dom';

import MenuCon from './MenuCon';
import Menu from './Menu';




export default function(routers,ApiMenu){
let Menus = Menu(ApiMenu)
    return class RouterRoot extends React.Component{
        render(){
            const {} = this.props;
            return(
                <React.Fragment>
                <HashRouter>
                    <div className="main-wrapper" style={{clear:'both',position:"relative",margin:'0 20px'}}>
                        <MenuCon style={{width:"220px",position:'absolute',top:0,bottom:0}} fixed={{
                                    float: 'none !important',
                                    position: 'fixed',
                                    top: '0px',
                                    bottom:'40px',
                        }}>
                            <Menus/>
                        </MenuCon>
                        <div className="main-container" style={{marginLeft:'240px',marginBottom:'20px',border:"1px solid #E9E9E9",minHeight:"100vh",width:'1040px',
                        padding:"20px",paddingTop:'0',position:'relative'}}>
                        {
                            routers.map((item,key)=>{
                                return(
                                    <Route key={key} path={item.path} component={item.component} />
                                )
                            })
                        }
                        </div>
                    </div>
                </HashRouter>
                </React.Fragment>
             )
        }
    }
}
